<template>
  <div class="qm-step-banner">
    <img src="static/img/step/bg_liucheng.png" alt="" />
    <div class="step-box">
      <template v-for="(item, index) in stepInfo">
        <div
          class="step-num"
          :class="{ active: currentStep >= index + 1 }"
        >
          {{ index + 1 }}
          <div class="step-title">{{ item }}</div>
        </div>
        <div
          class="dashed"
          :class="{ active: currentStep >= index + 2 }"
          v-if="index !== stepInfo.length - 1"
        ></div>
      </template>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    currentStep: {
      type: Number,
      default: 1,
    },
  },
  data() {
    return {
      stepInfo: ["被访单位", "来访人信息", "提交预约"],
    };
  },
};
</script>

<style lang="less" scoped>
.qm-step-banner {
  padding-top: 58.6%;
  height: 0;
  position: relative;

  img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
  }

  .step-box {
    position: absolute;
    padding: 0 calc(93px * var(--ratio));
    width: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: space-around;

    .step-num {
      flex-shrink: 0;
      width: calc(54px * var(--ratio));
      height: calc(54px * var(--ratio));
      line-height: calc(54px * var(--ratio));
      box-sizing: content-box;
      text-align: center;
      border-radius: 50%;
      background: #ffffff;
      color: #3385ff;
      outline: calc(4px * var(--ratio)) solid rgba(255, 255, 255, 0);
      opacity: 0.6;
      position: relative;

      .step-title {
        width: auto;
        text-align: center;
        white-space: nowrap;
        color: #fff;
        position: absolute;
        bottom: calc(-28px * var(--ratio));
        left: 50%;
        transform: translate(-50%, 100%);
      }

      &.active {
        outline: calc(4px * var(--ratio)) solid rgba(255, 255, 255, 0.6);
      }
    }

    .dashed {
      flex: 1;
      // width: calc(150px * var(--ratio));
      margin: 0 calc(24px * var(--ratio));
      height: 3px;
      background: linear-gradient(
        to right,
        #ffffff,
        #ffffff 4.5px,
        transparent 4.5px,
        transparent
      );
      background-size: 9px 100%;
      opacity: 0.6;
    }
    .active {
      opacity: 1;
    }
  }
}
</style>
